package com.ticket.sass.provider.dto.input.cinema;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author ywb
 * @date 2022-05-05 10:27
 */
@Data
@ApiModel(value = "影院新增输入DTO", description = "按照要求填写")
public class CinemaAddInput {
    @NotBlank(message = "影院名称不能为空")
    @ApiModelProperty(value = "影院名称", required = true)
    private String name;
    
    @NotBlank(message = "影院简称不能为空")
    @ApiModelProperty(value = "影院简称", required = true)
    private String shortName;
    
    @Pattern(regexp="^[0-9]*$", message="必须为数字")
    @NotBlank(message = "影院编码不能为空")
    @Size(max = 8, min = 8, message = "影院编码必须 8 位")
    @ApiModelProperty(value = "专资编码")
    private String zzCode;
    
    @ApiModelProperty(value = "影院LOGO")
    private String logo;
    
    @ApiModelProperty(value = "经度")
    private Double lng;
    
    @ApiModelProperty(value = "纬度")
    private Double lat;
    
    @Pattern(regexp="^[0-9]*$", message="必须为数字")
    @ApiModelProperty(value = "区域编码")
    private String areaCode;

    @NotBlank(message = "影院地址不能为空")
    @ApiModelProperty(value = "地址", required = true)
    private String addr;
    
    @NotNull(message = "租户ID不能为空")
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;
    
    @ApiModelProperty(value = "联系方式")
    @Valid // 添加 @Valid 注解，启用嵌套验证
    private List<@Pattern(regexp="^(1[3456789]\\d{9}|0\\d{2,3}-?\\d{7,8})$", message="必须是手机号或座机号") String> contact;
    
    @Valid
    @NotNull(message = "请选择售票系统")
    @ApiModelProperty(value = "售票系统", required = true)
    private TicketServerConfigInput ticketServerConfig;
    
    @Valid
    @NotNull(message = "服务费配置不能为空")
    @ApiModelProperty(value = "服务费配置", required = true)
    private ServiceChargeInput serviceChargeConfig;
}
